import { get, post, del, put } from "@/utils/request";
import {
  type supplierAddParams,
  type supplierListData,
  type supplierListReturn,
  type supplierParams,
} from "./type";

// 供应商列表
export const supplierList = (data: supplierParams) => {
  return get<supplierParams, supplierListReturn>("/api/supplier/list", data);
};

// 添加
export const supplierAdd = (data: supplierAddParams) => {
  return post<supplierAddParams, supplierListData>("/api/supplier/add", data);
};

// 编辑
export const supplierEdit = (data: supplierAddParams) => {
  return put<supplierAddParams, supplierListData>("/api/supplier/update", data);
};

// 删除
export const supplierDel = (id: number) => {
  return del<number, null>(`/api/supplier/delete/${id}`);
};

// 批删
export const supplierDelAlll = (data: number[]) => {
  return post<number[], null>("/api/supplier/deleteAll", data);
};
